package de.se2.sharebox.frames;

import java.awt.*;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class LoginFrame extends JFrame
{

	private JLabel jlbTitle = new JLabel("Einloggen", JLabel.CENTER);
	private JLabel jlbAdresse = new JLabel("geben Sie Ihre Email ein");
	private JTextField jtfEmailAddress = new JTextField();
	private JLabel jlbPassword = new JLabel("geben Sie Ihre Passwort ein");
	private JPasswordField jpfPasswort = new JPasswordField();
	private JButton jbOk = new JButton("Ok");
	private JButton jbRegistrieren = new JButton("Registrieren");

	public LoginFrame()
	{
		this.InitForm();
	}

	private void InitForm()
	{
		setTitle("Einloggen");
		this.setLayout(new GridLayout(0, 2, 6, 4));
		this.add(jlbAdresse);
		this.add(jtfEmailAddress);
		this.add(jlbPassword);
		this.add(jpfPasswort);
		this.add(jbOk);
		this.add(jbRegistrieren);

		this.setSize(400, 200);
		// this.pack();
		setVisible(true);
	}

	public String getEmail()
	{
		return this.jtfEmailAddress.getText();
	}

	public String getPassword()
	{
		return this.jpfPasswort.getText();
	}

	public void setEmail(String text)
	{
		this.jtfEmailAddress.setText(text);
	}

	public void setPassword(String pass)
	{
		this.jpfPasswort.setText(pass);
	}

	public void setLoginListener(ActionListener al)
	{
		this.jbOk.addActionListener(al);
	}

	public void setRegistrationListener(ActionListener al)
	{
		this.jbRegistrieren.addActionListener(al);
	}
}
